<html lang="UTF-8" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>基顶模量计算</title>
    <script src="jquery-1.10.0.js" type="text/javascript"></script>
    <!--<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.0.js"></script>-->
    <style>
        table.dataintable {
            margin-top:15px;
            border-collapse:collapse;
            border:1px solid #aaa;
            width:100%;
        }
        table.dataintable th {
            vertical-align:baseline;
            padding:5px 15px 5px 6px;
            background-color:#3F3F3F;
            border:1px solid #3F3F3F;
            text-align:left;
            color:#fff;
        }
        table.dataintable td {
            vertical-align:text-top;
            padding:6px 15px 6px 6px;
            border:1px solid #aaa;
        }
        table.dataintable tr:nth-child(odd) {
            background-color:#F5F5F5;
        }
        table.dataintable tr:nth-child(even) {
            background-color:#fff;
        }
    </style>

</head>

<body>
    <table class="dataintable">
        <tr>
            <th>输入项</th>
            <th></th>
            <th></th>
        </tr>
        <tr>
            <th>输入参数名</th>
            <th>输入参数值</th>
            <th>输入参数单位及限制</th>
        </tr>
        <tr>
            <td><i>道路等级:</i></td>
            <td>
                <select id="roadgrade" name="roadgrade" required="required">
                <option value="0">高速道路</option>
                <option value="1">一级道路</option>
                <option value="2">其它道路</option>
                </select>
            </td>
            <td></td>
        </tr>
        <tr>
            <td><i>道面平整度值σ:</i></td>
            <td><input type="text" id="roadflatness" required="required"/></td>
            <td></td>
        </tr>
        <tr>
            <td><i>行车速度v:</i></td>
            <td><input type="text" id="drivingspeed" required="required"/></td>
            <td>(单位：m/s)</td>
        </tr>
        <tr>
            <td><i>设计容许弯沉:</i></td>
            <td><input type="text" id="designallowdef" required="required"/></td>
            <td>(单位：mm)</td>
        </tr>
        <tr>
            <td><i>距离轮胎外侧的距离:</i></td>
            <td><select id="disouttireenum" name="disouttireenum" required="required">
                <option value="0.4">0.4m</option>
                <option value="0.6">0.6m</option>
                <option value="0.8">0.8m</option>
            </select></td>
            <td></td>
        </tr>
        <tr>
            <td><i>面层厚度hc</i></td>
            <td><select id="surfacethickness" name="surfacethickness" required="required">
                <option value="0.14">0.14</option>
                <option value="0.15">0.15</option>
                <option value="0.16">0.16</option>
                <option value="0.17">0.17</option>
                <option value="0.18">0.18</option>
                <option value="0.19">0.19</option>
                <option value="0.20">0.20</option>
                <option value="0.21">0.21</option>
                <option value="0.22">0.22</option>
                <option value="0.23">0.23</option>
                <option value="0.24">0.24</option>
                <option value="0.25">0.25</option>
                <option value="0.26">0.26</option>
                <option value="0.27">0.27</option>
                <option value="0.28">0.28</option>
                <option value="0.29">0.29</option>
                <option value="0.30">0.30</option>
            </select></td>
            <td>0.14m≤ (数值) ≤0.30m(单位：m)</td>
        </tr>
        <tr>
            <td><i>面层模量Ec</i></td>
            <td><input id="surfacemodulus" type="text" required="required"/></td>
            <td>500MPa≤ (数值) ≤6000MPa (单位：MPa)</td>
        </tr>
        <tr>
            <td><i>实测值</i></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td><i>弯沉s</i></td>
            <td><input id="deflection" type="text"/></td>
            <td>(单位：mm)</td>
        </tr>
        <tr>
            <td><i>应变ε</i></td>
            <td><input id="strain" type="text"/></td>
            <td>(单位：με)</td>
        </tr>
        <tr>
            <td><i>频率f</i></td>
            <td><input id="frequency" type="text" required="required"/></td>
            <td>(单位：Hz)</td>
        </tr>
        <tr>
            <td><i></i></td>
            <td><input id="submit" type="button" value="计算" /></td>
            <td></td>
        </tr>
        <tr>
            <th>输出项</th>
            <th></th>
            <th></th>
        </tr>
        <tr>
            <td><i>基顶当量回弹模量实测值</i></td>
            <td><label id="labelA11" /></td>
            <td>(单位：MPa)</td>
        </tr>
        <tr>
            <td><i>SSI</i></td>
            <td><label id="labelA21" /></td>
            <td>(单位：1)</td>
        </tr>
        <tr>
            <td><i>PSSI</i></td>
            <td><label id="labelA31" /></td>
            <td>(单位：1)</td>
        </tr>
        <tr>
            <td><i>SSI道路等级</i></td>
            <td><label id="labelA41" /></td>
            <td></td>
        </tr>
        <tr>
            <td><i>PSSI道路等级</i></td>
            <td><label id="labelA51" /></td>
            <td></td>
        </tr>
    </table>

</div>

</body>
</html>
<script type="text/javascript">

    $("#submit").click(function() {
        var surfacemodulus=document.getElementById("surfacemodulus").value;
        if (surfacemodulus<500 || surfacemodulus>6000) {
            alert("面层模量Ec输入非法")
            return;
        }
        topModCal();
    });

    /**
     * 基顶当量回弹模量实测值计算
     * @param surfaceThickness
     * @param surfaceModulus
     * @param frequency
     * @return
     */
    function calForm(surfaceThickness,surfaceModulus,frequency) {
        var e=2.718281828459;
        var result=0.00;
        if (parseFloat(surfaceThickness)==parseFloat(0.14)) { // 014
            result= (0.0035*Math.pow(surfaceModulus*0.001,0.0841)*Math.pow(e,((-0.0081)*Math.log(surfaceModulus*0.001)+0.472)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.15)) { // 015
            result= (0.0035*Math.pow(surfaceModulus*0.001,0.0841)*Math.pow(e,((-0.007)*Math.log(surfaceModulus*0.001)+0.4718)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.16)) { // 016
            result= (0.0035*Math.pow(surfaceModulus*0.001,0.0841)*Math.pow(e,((-0.007)*Math.log(surfaceModulus*0.001)+0.4715)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.17)) { // 017
            result= (0.0036*Math.pow(surfaceModulus*0.001,0.0743)*Math.pow(e,((-0.007)*Math.log(surfaceModulus*0.001)+0.4713)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.18)) { // 018
            result= (0.0036*Math.pow(surfaceModulus*0.001,0.0695)*Math.pow(e,((-0.006)*Math.log(surfaceModulus*0.001)+0.4711)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.19)) { // 019
            result= (0.0036*Math.pow(surfaceModulus*0.001,0.0695)*Math.pow(e,((-0.006)*Math.log(surfaceModulus*0.001)+0.4708)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.20)) { // 020
            result= (0.0036*Math.pow(surfaceModulus*0.001,0.0569)*Math.pow(e,((-0.006)*Math.log(surfaceModulus*0.001)+0.4707)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.21)) { // 021
            result= (0.0036*Math.pow(surfaceModulus*0.001,0.0523)*Math.pow(e,((-0.006)*Math.log(surfaceModulus*0.001)+0.4705)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.22)) { // 022
            result= (0.0037*Math.pow(surfaceModulus*0.001,0.0468)*Math.pow(e,((-0.006)*Math.log(surfaceModulus*0.001)+0.4703)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.23)) { // 023
            result= (0.0037*Math.pow(surfaceModulus*0.001,0.0481)*Math.pow(e,((-0.005)*Math.log(surfaceModulus*0.001)+0.4701)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.24)) { // 024
            result= (0.0037*Math.pow(surfaceModulus*0.001,0.0396)*Math.pow(e,((-0.005)*Math.log(surfaceModulus*0.001)+0.47)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.25)) { // 025
            result= (0.0037*Math.pow(surfaceModulus*0.001,0.0424)*Math.pow(e,((-0.005)*Math.log(surfaceModulus*0.001)+0.4698)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.26)) { // 026
            result= (0.0037*Math.pow(surfaceModulus*0.001,0.0424)*Math.pow(e,((-0.005)*Math.log(surfaceModulus*0.001)+0.4697)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.27)) { // 027
            result= (0.0038*Math.pow(surfaceModulus*0.001,0.0379)*Math.pow(e,((-0.005)*Math.log(surfaceModulus*0.001)+0.4695)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.28)) { // 028
            result= (0.0038*Math.pow(surfaceModulus*0.001,0.0296)*Math.pow(e,((-0.005)*Math.log(surfaceModulus*0.001)+0.4694)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.29)) { // 029
            result= (0.0038*Math.pow(surfaceModulus*0.001,0.0288)*Math.pow(e,((-0.004)*Math.log(surfaceModulus*0.001)+0.4692)*frequency))*1000;
        } else if (parseFloat(surfaceThickness)==parseFloat(0.30)) { // 030
            result= (0.0038*Math.pow(surfaceModulus*0.001,0.0288)*Math.pow(e,((-0.004)*Math.log(surfaceModulus*0.001)+0.4692)*frequency))*1000;
        }
        return result;
    }

    /**
     * 计算弯沉
     * @param disOutTireEnum
     * @param deflection
     * @return
     */
    function calFormWc( disOutTireEnum, deflection) {
        var result=0.00;
        if (parseFloat(disOutTireEnum)==parseFloat(0.4)) { // 04
            result= 0.8791*deflection-0.0087;
        } else if (parseFloat(disOutTireEnum)==parseFloat(0.6)) { // 06
            result= 1.092*deflection-0.0188;
        } else if (parseFloat(disOutTireEnum)==parseFloat(0.8)) { // 08
            result= 1.1116*deflection-0.0487;
        }
        return result;
    }

    /**
     * 计算应变
     * @param disOutTireEnum
     * @param et
     * @param strain
     * @return
     */
    function calFormYb( disOutTireEnum, et,  strain) {
        var result=0.00;
        var e=2.718281828459;
        if (parseFloat(disOutTireEnum)==parseFloat(0.4)) { // 04
            result= 0.9765*Math.pow(e,0.0007*et)*strain*(-0.001)+(0.0979*Math.log(et)-0.8138);
        } else if (parseFloat(disOutTireEnum)==parseFloat(0.6)) { // 06
            result= 0.9492*Math.pow(e,0.0008*et)*strain*(-0.001)+(0.1020*Math.log(et)-0.8407);
        } else if (parseFloat(disOutTireEnum)==parseFloat(0.8)) { // 08
            result= 1.0079*Math.pow(e,0.0002*et)*strain*(-0.001)+(0.0783*Math.log(et)-0.6968);
        }

        return result;
    }

    /**
     * 车轮作用位置处路表弯沉与静弯沉转换关系
     * @param s0
     * @param roadFlatness
     * @param drivingSpeed
     * @return
     */
    function calFormJwc( s0, roadFlatness, drivingSpeed) {
        var result=0.00;
        result=s0/(1+11.5*0.001*roadFlatness/0.6*Math.sqrt(drivingSpeed));
        return result;
    }

    /**
     * 计算SSI
     * @param designAllowDef
     * @param jwc
     * @return
     */
    function calFormSsi( designAllowDef, jwc) {
        designAllowDef=Math.abs(designAllowDef);
        jwc=Math.abs(jwc);
        var result=0.00;
        result=designAllowDef/jwc;
        return Math.abs(result);
    }

    /**
     * 计算PSSI
     * @param ssi
     * @return
     */
    function calFormPssi( ssi) {
        var result=0.00;
        var e=2.718281828459;
        result=100/(1+15.71*Math.pow(e,(-5.19)*ssi));
        return result;
    }

    /**
     * SSI道路等级
     * @param roadGradeEnum
     * @param ssi
     * @return
     */
    function judgeSsiRoadEvaLevel( roadGradeEnum, ssi) {
        var result="";
        // SSI判断
        if (roadGradeEnum=="0"||roadGradeEnum=="1") {
            if (parseFloat(ssi)>=parseFloat(1.0)) {
                result="优";
            } else if (parseFloat(ssi)>=parseFloat(0.83) && parseFloat(ssi)<=parseFloat(1.0)) {
                result="良";
            } else if (parseFloat(ssi)>=parseFloat(0.66) && parseFloat(ssi)<=parseFloat(0.83)) {
                result="中";
            } else if (parseFloat(ssi)>=parseFloat(0.5) && parseFloat(ssi)<=parseFloat(0.66)) {
                result="次";
            } else {
                result="差";
            }
        } else if (roadGradeEnum.equals("2")) {
            if (parseFloat(ssi)>=parseFloat(0.83)) {
                result="优";
            } else if (parseFloat(ssi)>=parseFloat(0.66) && parseFloat(ssi)<=parseFloat(0.83)) {
                result="良";
            } else if (parseFloat(ssi)>=parseFloat(0.5) && parseFloat(ssi)<=parseFloat(0.66)) {
                result="中";
            } else if (parseFloat(ssi)>=parseFloat(0.3) && parseFloat(ssi)<=parseFloat(0.5)) {
                result="次";
            } else {
                result="差";
            }
        }

        return result;
    }

    /**
     * PSSI道路等级
     * @param roadGradeEnum
     * @param pssi
     * @return
     */
    function judgePssiRoadEvaLevel( roadGradeEnum, pssi) {
        var result="";

        // PSSI判断
        if (parseFloat(pssi)>=parseFloat(91.9)) {
            result="优";
        } else if (parseFloat(pssi)>=parseFloat(82.6) && parseFloat(pssi)<=parseFloat(91.9)) {
            result="良";
        } else if (parseFloat(pssi)>=parseFloat(66.2) && parseFloat(pssi)<=parseFloat(82.6)) {
            result="中";
        } else if (parseFloat(pssi)>=parseFloat(45.8) && parseFloat(pssi)<=parseFloat(66.2)) {
            result="次";
        } else {
            result="差";
        }

        return result;
    }

    function topModCal(){

        // 计算数值
        var roadGradeEnum= document.getElementById("roadgrade").value;
        var roadFlatness= document.getElementById("roadflatness").value;
        var drivingSpeed= document.getElementById("drivingspeed").value;
        var designAllowDef=document.getElementById("designallowdef").value;
        var disOutTireEnum= document.getElementById("disouttireenum").value;
        var surfaceThickness= document.getElementById("surfacethickness").value;
        var surfaceModulus= document.getElementById("surfacemodulus").value;
        var deflection= document.getElementById("deflection").value;
        var strain= document.getElementById("strain").value;
        var frequency= document.getElementById("frequency").value;

        // 计算Et
        var et=calForm(surfaceThickness,surfaceModulus,frequency);

        // 计算s0
        var s0=0.00;
        if (deflection!="" && parseFloat(deflection)>parseFloat(0.00)) {
            s0=calFormWc(disOutTireEnum,deflection);
        } else {
            s0=calFormYb(disOutTireEnum,et,strain);
        }

        // 计算S静
        var jwc=calFormJwc(s0,roadFlatness,drivingSpeed);

        // 计算SSI
        var ssi=calFormSsi(designAllowDef,jwc);

        // 计算PSSI
        var pssi=calFormPssi(ssi);

        // 计算SSI道路等级
        var roadssievalevel=judgeSsiRoadEvaLevel(roadGradeEnum,ssi);

        // 计算PSSI道路等级
        var roadpssievalevel=judgePssiRoadEvaLevel(roadGradeEnum,pssi);

        // 计算结果展示
        $("#labelA11").html(et);
        $("#labelA21").html(ssi);
        $("#labelA31").html(pssi);
        $("#labelA41").html(roadssievalevel);
        $("#labelA51").html(roadpssievalevel);

    }
</script>
